<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    <base href="<%=basePath%>">
    <meta http-equiv="X-UA-Compatible" content="IE=11" >
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
    <title>列表</title>
<script type="text/javascript" src="js/jcpfree.js" charset="UTF-8"></script>
<script src="js/jquery-1.8.3.min.js"></script>

<script type="text/javascript" src="js/code/qrcode.min.js"></script>
<script type="text/javascript" src="js/code/qrcode.js"></script>
<style type="text/css">
@media print {
   input {display:none}
}
div{
 font-size: 12px
}
a{text-decoration:none;
        color:#FFFFFF;
        border:1px solid #999;
        background-color: rgba(7, 140, 255, 0.88);;
        text-align:center;
        margin:2px 5px;
        float:left;                         
        width:150px;
        height:20px;
        line-height: 20px;
        border-radius: 5px;
}
</style>





<script>
	function doPrint(how) {
	   var myDoc = {  
          settings : {  
          // paperWidth : 178, // 自定义纸张， 宽度为 200mm
          // paperHeight : 127  // 高度为 150mm
          paperName : "A4", // 设置了 paperWidth,paperHeight，就不要设置 paperName了，二选一
      },

			documents : document, // 打印页面(div)们在本文档中
			copyrights : '杰创软件拥有版权  www.jatools.com', // 版权声明必须
			
		};
		var jcp = getJCP();
		// 调用打印方法
		if (how == '打印预览')
			jcp.printPreview(myDoc, false);
		else if (how == '选择打印机') {
			jcp.print(myDoc, true);
		} else
			jcp.print(myDoc, false); // 不弹出对话框打印
	}
</script>
  </head>  
    
  <body>
  <div id="page1" style="float: left;">
      <div style="margin-left: 130px;padding-top: 63px;font-size: large;">${waiter.name}</div>
       <div style="margin-left: 130px;padding-top: 40px;font-size: large;">${waiter.sex}</div>
       <div style="margin-left: 105px;padding-top: 45px;font-size: large;">${waiter.idcard }</div>
       <div style="margin-left: 130px;padding-top: 40px;font-size: large;">${waiter.affiliation }</div>
      <c:if test="${waiter.type  == '民办非企业'}">
          <div style="margin-left: 118px;padding-top: 48px;font-size: large;">√</div>
      </c:if>
      <c:if test="${waiter.type == '有限公司'}">
          <div style="margin-left: 295px;padding-top: 48px;font-size: large;">√</div>
      </c:if>
       <div style="margin-left: 130px;padding-top: 40px;font-size: large;">${waiter.qualId}</div>
       <div style="margin-left: 200px;padding-top: 40px;font-size: large;">${waiter.medalId }</div>
       <div style="margin-left: 230px;padding-top: 20px;font-size: large;white-space:normal;
         word-break:break-all;word-wrap:break-word; width:200px;">${waiter.persion }</div>
      <div id="code" style="width:100px; height:100px; margin-top:-100px;margin-left: 100px"></div>
       <br/><br/><br/><br/><input type="button" value="打印预览" onClick="doPrint('打印预览')">
	  <input type="button" value="选择打印机" onClick="doPrint('选择打印机')">
	  <input type="button" value="直接打印" onClick="doPrint('直接打印')">
	  <input type="button" value="返回" onclick="javascript:window.history.back(-1);">
    </div>
  </body>
 

<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("code"), {
	width : 90,
	height : 100
});

function makeCode () {		
	var elText = document.getElementById("text");
	
	if (!elText.value) {
		alert("Input a text");
		elText.focus();
		return;
	}
	
	qrcode.makeCode(elText.value);
}

makeCode();

$("#text").
	on("blur", function () {
		makeCode();
	}).
	on("keydown", function (e) {
		if (e.keyCode == 13) {
			makeCode();
		}
	});
</script>
</html>
